Respiratory apparatus with improved flow-flattening detection

ABSTRACT

In a respiratory apparatus for treatment of sleep apnea and other disorders associated with an obstruction of a patient&#39;s airway and which uses an airflow signal, an obstruction index is generated which detects the flattening of the inspiratory portion of the airflow. The obstruction index is used to differentiate normal and obstructed breathing. The obstruction index is based upon different weighting factors applied to sections of the airflow signal thereby improving sensitivity to various types of respiration obstructions.

[0001] This application claims the priority filing date of U.S.Provisional Application Ser. No. 60/228,630 filed on Aug. 29, 2000.

FIELD OF THE INVENTION

[0002] This invention relates to a method and apparatus for detectingobstruction of the airway of a patient. More specifically, the inventioninvolves an improved method and apparatus for detecting obstruction,either partial or complete, based upon a flattened measure of aninspiratory portion of respiratory airflow. The method is useful inpatient ventilators such as those used in the diagnosis and treatment ofrespiratory conditions including sleep apnea or hypopnea.

BACKGROUND OF THE INVENTION

[0003] The dangers of obstructed breathing during sleep are well knownin relation to the Obstructive Sleep Apnea (OSA) syndrome. Apnea,hypopnea and heavy snoring are recognized as causes of sleep disruptionand risk factors in certain types of heart disease.

[0004] The monitoring of upper airway pressure-flow relationships inobstructive sleep apnea has been described in Smith et al., 1988, J.Appl Physiol. 64: 789-795. FIG. 1 of that article shows polygraphicsleep recordings at varying levels of increasing nasal pressure. It wasnoted that inspiratory volumetric flow plateaued in certain breathssuggesting the presence of airflow limitation. Pressure-flow curves wereconstructed by plotting midinspiratory airflow against either maskpressure or endoesophageal pressure. The pressure-flow plots of nasalpressure against mean midinspiratory flow were then fit by least-squareslinear regression to calculate resistance upstream to the collapsiblesite.

[0005] The effect of positive nasal pressure on upper airwaypressure-flow relationships has been described in Schwartz et al., 1989,J. Appl Physiol. 66: 1626-1634. FIG. 4 of the article shows thatpressure-flow tracings plateau at a low pressure level. It was furthershown when the pressure was increased, flow did not plateau.

[0006] The common method of treatment of these syndromes is toadminister Continuous Positive Airway Pressure (CPAP). The procedure foradministering CPAP treatment has been documented in both the technicaland patent literature. Briefly stated, CPAP treatment acts as apneumatic splint of the airway by the provision of a positive pressure,usually in the range 4-20 cm H₂O. The air is supplied by a motor drivenblower whose output passes via an air delivery device to sealinglyengage a patient's airway. A mask, tracheotomy tube, endotracheal tube,nasal pillows or other appropriate device may be used. An exhaust portis provided in a delivery tube proximate to the air delivery device.Other forms of CPAP, such as bi-level CPAP, and self-titrating CPAP, aredescribed in U.S. Pat. Nos. 5,148,802 and 5,245,995 respectively.

[0007] With regard to the control of CPAP treatment, various techniquesare known for sensing and detecting abnormal breathing patternsindicative of obstruction. For example, U.S. Pat. No. 5,245,995describes how snoring and abnormal breathing patterns can be detected byinspiration and expiration pressure measurements while sleeping, therebyleading to early indication of preobstructive episodes or other forms ofbreathing disorder. Particularly, patterns of respiratory parameters aremonitored, and CPAP pressure is raised on the detection of pre-definedpatterns to provide increased airway pressure to ideally prevent theoccurrence of the obstructive episodes and the other forms of breathingdisorder.

[0008] Similarly, U.S. Pat. No. 5,335,654 (Rapoport) lists severalindices said to be indications of flow limitation and/or partialobstruction patterns including: (1) The derivative of the flow signalequals zero; (2) The second derivative between peaks of the flow signalis zero for a prolonged interval; (3) The ratio of early inspirationalflow to midinspirational flow is less than or equal to 1. The patentfurther lists events said to be indications of obstructions: (1) Reducedslope of the line connecting the peak inspiratory flow to the peakexpiratory flow; (2) Steep upward or downward stroke (dV/dt) of the flowsignal; and (3) Ratio of inspiratory flow to expiratory flow over 0.5.

[0009] U.S. Pat. No. 5,645,053 (Remmers) describes calculating aflatness index, wherein flatness is defined to be the relative deviationof the observed airflow from the mean airflow. In Remmers, individualvalues of airflow are obtained between 40% and 80% of the inspiratoryperiod. The mean value is calculated and subtracted from individualvalues of inspiratory flow. The individual differences are squared anddivided by the total number of observations minus one. The square rootof this result is used to determine a relative variation. The relativevariation is divided by the mean inspiratory airflow to give a relativedeviation or a coefficient of variation for that breath.

[0010] In commonly owned U.S. Pat. No. 5,704,345, Berthon-Jones alsodiscloses a method for detecting partial obstruction of a patient'sairway. Generally, the method involves a determination of twoalternative obstruction index values based upon the patient's monitoredrespiratory airflow. Either obstruction index may then be compared to athreshold value. Essentially, the index values may be characterized asshape factors that detect a flattening of an inspiratory portion of apatient's respiratory airflow. The first shape factor involves a ratioof the mean of a midportion of the inspiratory airflow of the breathingcycle and the mean of the inspiratory airflow. The formula for shapefactor 1 is as follows:${{shapefactor\_}1} = \frac{\frac{1}{33}{\sum\limits_{t = 16}^{48}\quad {f_{s}(t)}}}{M}$

[0011] where f_(s)(t) is a sample of the patient's inspiratory airflowand M is the mean of inspiratory airflow given by the following:$M = {\frac{1}{65}{\sum\limits_{t = 1}^{65}\quad {f_{s}(t)}}}$

[0012] A second shape factor involves a ratio of the Root Mean Squaredeviation of a midportion of inspiratory airflow and the meaninspiratory airflow according to the formula:${{shapefactor\_}2} = \frac{\sqrt{\frac{1}{33}{\sum\limits_{t = 16}^{48}\quad \left( {{f_{s}(t)} - M} \right)^{2}}}}{M}$

[0013] Berthon-Jones further discloses a scaling procedure applied tothe inspiratory airflow samples such that the mean M of the samplesf_(s)(t) is unity (M=1). This scaling procedure simplifies both shapefactor formulas. Additional adjustments to f_(s)(t) including averagingand the elimination of samples from erratic breaths such as coughs,sighs, hiccups, etc., are also taught by Berthon-Jones. The foregoingU.S. Patent is hereby incorporated by reference.

[0014] The present invention involves an improved method and apparatusfor detecting some forms of obstruction based upon the flattening of theinspiratory airflow.

BRIEF DESCRIPTION OF THE INVENTION

[0015] An objective of the present invention is to provide an apparatusin which obstruction, either partial or complete, of the patient'sairway is detected by analyzing respiratory airflow.

[0016] A further objective is to provide an apparatus in which a novelalgorithm for detecting airway obstruction is implemented without usingadditional components or making substantial changes to the structure ofexisting respiratory apparatus.

[0017] Accordingly, a respiratory apparatus is provided in which therespiratory airflow of a patient is continuously monitored. The part ofrespiratory airflow associated with inspiration is identified andsampled. From these inspiration samples, several samples representing amidportion of inspiration are identified. One or more weightingparameters or weighting factors are associated with each midportionsample. These weights and midportion samples are then used to calculatean obstruction index. Finally, this obstruction index is compared to athreshold value which comparison is used to adjust or controlventilatory assistance.

[0018] In one embodiment, weighting factors are applied based on whetherthe inspiratory airflow samples are less than or greater than athreshold level, such as the mean airflow.

[0019] In another embodiment, different weighting factors are applied tosamples based on their time positions in a breath. Samples taken priorto a certain event during inspiration, for example, samples precedingthe half way point of inspiration, are assigned lower weighting factorsthan samples succeeding the event. An obstruction index is thencalculated using these samples with their corresponding weightingfactors.

[0020] In one aspect, the subject invention pertains to a respiratoryapparatus which includes a gas source adapted to selectively providepressurized breathable gas to a patient, a flow sensor to sense therespiratory airflow from the patient and to generate an airflow signalindicative of airflow, an obstruction detector coupled to said flowsensor which includes a weight assigning member arranged to assignseveral weight factors to portions of the flow signal and to generate anobstruction signal using the weighted portions, and a controller coupledto the flow sensor and arranged to control the operation of the gassource, receive the obstruction signal and alter the operation of thegas source in response to the obstruction signal.

[0021] Another aspect of the invention concerns an apparatus formonitoring and/or treating a patient having a sleep disorder, theapparatus including a flow sensor that senses patient respiration andgenerates a corresponding flow signal; and an obstruction detectorcoupled to the flow sensor and adapted to determine a weighted averagesignal, the weighted average signal being dependent on a weightedaverage of the flow signal in accordance with one of an amplitude and atime position of portions of the flow signal, the obstruction detectorincluding a signal generator that generates a signal indicative of anairway obstruction based on the weighted average signal.

[0022] A further aspect of the invention concerns an apparatus fortreating a patient having a sleep disorder, the apparatus comprising amask, a gas source selectively supplying pressurized breathable air tothe patient through the mask, a flow sensor that senses airflow andgenerates a flow signal indicative of respiration, an obstructiondetector coupled to the flow sensor and adapted to determine a weightedaverage signal, the weighted average signal being dependent on aweighted average of the flow signal in accordance with one of anamplitude and a time position of portions of the flow signal, and acontroller receiving the obstruction signal and generating in response acommand for activating the gas source.

[0023] Another aspect of the invention concerns a method for detectingobstruction in the airways of a patient, including measuring an air flowof the patient, detecting a predetermined section of said air flow,assigning weights to portions of said predetermined section anddetermining an index value for said predetermined section based on saidweights as a measure of the obstruction.

BRIEF DESCRIPTION OF DRAWINGS

[0024]FIG. 1 shows a block diagram of a respiratory apparatusconstructed in accordance with this invention;

[0025]FIG. 2 shows a flow chart illustrating the operation of theapparatus of FIG. 1;

[0026]FIG. 3 shows the inspiration phases of typical respiration signalsfor a healthy person and a person with a partial airway obstruction;

[0027]FIG. 4 shows a portion of a normal respiration signal from apatient;

[0028]FIGS. 5 and 6 show portions of two different respiration signalscharacteristic from patients with sleep apnea;

[0029]FIG. 7 shows a flow chart for determining the flattening indicesfor the respiration signals of FIGS. 4-6;

[0030]FIG. 8 shows a normal breathing pattern for a person withoutrespiratory obstructions to illustrate the determination of two improvedobstruction indices;

[0031]FIGS. 9, 10, and 11 show various breathing patterns withobstructions identifiable using the improved indices:

[0032]FIG. 12 shows an example of how a flow curve can be checked toinsure that it is a valid respiration curve; and

[0033]FIG. 13 shows an example of how a typical respiration flow curvecan be trimmed.

DETAILED DESCRIPTION OF THE INVENTION

[0034] Apparatus and Methodology

[0035]FIG. 1 shows an example respiratory apparatus 10 constructed inaccordance with the invention. The respiratory apparatus 10 includes amask 12 connected to a blower 14 by a flexible tube 16. The mask 12 isfitted to the patient and may be either a nose mask or a face mask. Theblower 14 with an air outlet 22 is driven by a motor 18 in accordancewith control signals from a servocontroller 20. This arrangement allowsthe respiratory apparatus 10 to deliver pressurized air (or air enrichedwith oxygen from a source, not shown). The pressurized air is deliveredby tube 16 to the mask 12. The tube 16 is provided with a narrow exhaustport 26 through which air exhaled by the patient is expelled.

[0036] A control circuit 24 is used to control the operation ofservocontroller 20 and motor 18 using certain predetermined criteria,thereby defining modes of operation for the apparatus 10. Preferably, inaccordance with this invention, the control circuit 24 is adapted tooperate the apparatus 10 to provide CPAP to the patient.

[0037] Control circuit 24 includes a flow restrictive element 28. Tubes30 and 31 lead from restrictive element 28 to a differential pressuretransducer 34. Tube 30 is also connected through another tube 33 to amask pressure transducer 32.

[0038] The mask pressure transducer 32 generates a first electricalsignal which is amplified by an amplifier 36 to generate an output P(t)proportional to the air pressure within the mask 12. This output is feddirectly to the servocontroller 20.

[0039] The differential pressure transducer 34 senses the differentialpressure across the flow restrictive element 28, which differentialpressure is related to the air flow rate through the flow restrictiveelement 28 and tube 16. Differential pressure transducer 34 generates asecond electrical signal that is amplified by an amplifier 38. Thisamplified signal F(t) is termed an air flow signal since it representsthe air flow through the tube 16.

[0040] The air flow signal F(t) is fed to a filter 40 which filters thesignal within a preset range. The outputs of the filter 40 and amplifier36 are fed to an ADC (analog-to-digital) converter 42, which generatescorresponding signals fi to a microprocessor 44. The microprocessor 44generates analog control signals that are converted into correspondingdigital control signals by DAC 46 and used as a reference signal Pset(t) for the servo 20.

[0041] One method for the operation of a respiratory apparatus 10 isshown in the flow chart of FIG. 2. Individuals skilled in the art willrecognize other methodologies for utilizing the improved flow flatteningindex that is disclosed herein. The embodiment of the methodology ofFIG. 2 is also detailed in U.S. Pat. No. 5,704,345 (the '345 patent).The first step 100 is the measurement of respiratory flow (rate) overtime. This information is processed in step 102 to generate Index valuesto be used as qualitative measures for subsequent processing. Thus, Step102 includes the generation of obstruction index values based upon theweighting method as disclosed herein. Step 104 detects whether an apneais occurring by comparison of the breathing Index with a thresholdvalue.

[0042] If the answer in step 104 is “Yes”, an apnea is in progress andthere then follows a determination of patency in step 110. If there ispatency of the airway, a central apnea with an open airway is occurring,and, if desired, the event is logged in step 112. If the result of step110 is that the airway is not patent, then a total obstructive apnea ora central apnea with closed airway is occurring, which results in thecommencement or increase in CPAP treatment pressure in step 108. Ifdesired, step 108 may include the optional logging of the detectedabnormality.

[0043] If the answer in step 104 is “No”, one or more obstructionindices, such as the improved flow flattening indices, are compared withthreshold values in step 106, by which the determination of obstructionof the airway is obtained. If the answer is “Yes” in step 106, thenthere is a partial obstruction, and if “No”, there is no obstruction(normalcy).

[0044] Step 108 applies in the case of a complete or partial obstructionof the airway a consequential increase in CPAP treatment pressure. Inthe instance of normal breathing with no obstruction, the CPAP treatmentpressure is reduced, in accordance with usual methodologies that seek toset the minimal pressure required to obviate, or at least reduce, theoccurrence of apneas. The amount of reduction in step 107 may, ifdesired, be zero. Similarly, in the event of a central apnea with patentairway (step 110,112) treatment pressure is not increased. Suchincreases in pressure reflexively inhibit breathing, further aggravatingthe breathing disorder.

[0045] Improved Flow Flattening Indices

[0046]FIG. 3 depicts an airflow signal with respect to the inspiratoryportion of a typical breathing cycle. During the inspiratory portion ofthe breathing cycle of a healthy person, the airflow rises smoothly withinspiration, reaches a peak and falls smoothly to zero. However, apatient with a partially obstructed airway exhibits a breathing patterncharacterized by a significant flat zone during inspiration.Theoretically, for an obstructed flow, as the degree of partialobstruction increases, the airflow signal for inspiration would tend toa square wave.

[0047] As previously discussed, the '345 patent describes two shapefactors useful in testing for a flattening of the inspiratory portion ofa patient's breathing cycle. In the preferred embodiment of theinvention, the resulting obstruction index or flow flattening index(FFI) for each shape factor may be compared to unique threshold values.While the approach works well in many instances, it may not detectcertain obstruction patterns.

[0048] This can be illustrated by an examination of FIGS. 4-6. FIGS. 4-6depict portions of respiration cycles. FIG. 4 shows a normal respirationflow and FIG. 5 shows a severely obstructed respiration cycle in whichthe inspiration period is characterized by two high positive lobes A andB and a relatively flat zone C between lobes A and B. In FIG. 4, the RMSdeviation is indicated by the shaded area under the respiration flowcurve and above the mean inspiration flow. In FIG. 5, the RMS deviationis indicated by the shaded area above the respiration flow curve andbelow the mean inspiration flow. As seen in FIG. 5, due to obstruction,the mean inspiration flow is greater than it would be without the secondpositive lobe B. Therefore, when analyzing the flow using shape factorsof the '345 patent, the highly restricted and abnormal flow of FIG. 5would not be detected as an obstruction.

[0049] Similarly, FIG. 6 shows another possible respiration curve for apatient with a partial airway obstruction. This curve includes anabnormally wide initial positive lobe D preceding a flat portion E. Onceagain, because of the large lobe D the mean inspiration flow is higherthan for the more typical flow of FIG. 3. Using the prior artobstruction index, this condition may be detected as normal rather thanbeing properly detected as an obstructed flow.

[0050] In order to detect these obstructions while continuing toproperly respond to non-obstructed flows like the one of FIG. 4, thepresent invention assigns different weighting factors to the inspirationflow samples depending on:

[0051] (a) the magnitude of each sample with respect to the meaninspiration flow; and

[0052] (b) the time-wise position of each sample with respect to a timereference such as mid-inspiration.

[0053] By assigning a different weighting factor to a sample that isless than a particular value, for example, the mean flow, during theobstruction index or FFI calculation, there is an improved sensitivityto the respiration signal of FIG. 5 without affecting the FFI for normalbreathing where most of the flow is greater than the mean.

[0054] Similarly, by assigning a different weighting factor to samplesthat occur after a time reference point, the subsequent samples becomemore significant. This improves sensitivity to the respiration signal ofFIG. 6 without affecting the FFI for other breaths that are symmetricalin time about the center point of the inspiration.

[0055] An algorithm using one form of the invention for calculating theimproved FFI is shown in FIG. 7. In step 100 of FIG. 2, a typical flowrate curve F (defined by a plurality of samples f_(i) where i is anindex from 1 to the total number of samples n) is obtained. In step 200of FIG. 7, the curve F is checked to insure that it is a validinspiration curve. Next, in step 201 the curve F is trimmed to eliminateall samples f_(i) outside of the inspiration period. Methods ofimplementing steps 200 and 201 are discussed in more detail below. Instep 202, a mean M is calculated for all the inspiration samples 1through n using conventional techniques.

[0056] In step 204 two weighting factors which may be designated asvalue dependent factors w_(i) and time dependent factors v_(i) areassigned to each of the samples f_(i) based respectively on theamplitude of each sample and its time position in relation to theinspiration mean M and its center point respectively. For example, thefactors w_(i) and v_(i); may be assigned for each flow measurement f_(i)using the following rules:

[0057] A1. If f_(i)>M then w_(i)=1

[0058] A2. If f_(i)<M then w_(i)=0.5

[0059] B1. If f_(i) is taken prior to the inspiration center point, thenv_(i)=0.75.

[0060] B2. If f_(i) is taken after the inspiration center, thenv_(i)=1.25.

[0061] Next, in step 206 two alternative FFI or obstruction indices arecalculated using the formulas:${{value\_ weighted}{\_ index}} = \frac{\sum\limits_{i = j}^{k}{W_{i} \cdot {{f_{i} - M}}}}{M \cdot d}$${{time\_ weighted}{\_ index}} = \frac{\sum\limits_{i = j}^{k}{V_{i} \cdot {{f_{i} - M}}}}{M \cdot d}$

[0062] Where j is the first and k is the last sample relative to amidportion or center half of the inspiration curve F and d is the numberof samples of the midportion of inspiration or center half as shown inFIGS. 3-6, and M is the mean of the inspiration curve F. Alternatively,the algorithm may be described by the following steps:

[0063] Check the flow samples to confirm they represent a validinspiration cycle with a shape within acceptable bounds.

[0064] Trim samples from any “pre-inspiratory period”;

[0065] Find the mean of the inspiration flow samples;

[0066] Sum the weighed absolute difference of the flow samples from meanfor samples in the center half or mid portion of inspiration:

[0067] If flow sample is > mean, sum the difference (flow-mean);

[0068] If flow sample is < mean, sum ½ the difference;

[0069] If flow sample is before the center point of the inspiration, use75% of the difference from above;

[0070] If flow sample is after the center point of the inspiration, use125% of the difference from above;

[0071] Scale the sum by the mean and inspiration time to produce theflattening index: FFI=weighed absolute sum/(Center half time*meaninspiration flow)

[0072] As discussed above, in step 200 of FIG. 7, the curve F is checkedto insure that it corresponds to a valid inspiration curve. The flowcurve F is checked against an upper and lower bound to preventprocessing of an inspiratory curve corrupted by a cough, sigh, etc. Forexample, as shown in FIG. 12, the curve F may be rejected if it exceedsat any time an upper limit curve UL or falls below a lower limit curveLL. UL may be selected at about 150% of the mean inspiratory flow and LLmay be selected at about 50% of the mean inspiratory flow.

[0073] In step 201 the respiration curve is trimmed to eliminate samplesf_(i) occurring before the actual inspiration period. One method oftrimming includes the steps:

[0074] (1) determine the point where the flow reaches 75% of the peakinspiratory flow;

[0075] (2) determine the point where the flow reaches 25% of the peakinspiratory flow;

[0076] (3) extrapolate a line through these two points to the zero flowline to determine the point at the beginning of inspiration but use thefirst sample if the point is to the left of the first sample.

[0077] This trimming method is illustrated in FIG. 13. With reference tothe figure, the respiration curve F crosses the zero flow level at TO.Once the maximum inspiratory flow is reached, two intermediate flowlevels are determined: the ¼ inspiratory flow level (i.e. the flowequaling 25% of the maximum inspiratory flow) and the ¾ inspiratory flowlevel (i.e. the flow equaling 75% of the maximum inspiratory flow). InFIG. 13, curve F crosses these two levels at points F1 and F2,respectively. Using the times T1 and T2, corresponding to the points F1and F2, the curve F is approximated by a line L. This line is thenextended to the zero flow level to determine an extrapolated time TS asthe starting time for inspiration period for curve F. Samples f_(i)obtained prior to TS are ignored.

[0078] The improvement resulting from the use of the above describedvalue and time weighted obstruction indices can be seen with anexamination of simulated tests. To this end, FIGS. 8, 9,10 and 11 showbreathing patterns of patients with both normal and obstructedrespiration. These patterns were analyzed using the weighted indices ofthe present invention, as well as the shape factor 2 that uses equalweight samples f_(i) as described in the '345 patent. The results of thetests are shown in the table below. TABLE I Equal weight Value weightedTime weighted Index index index 0.26 0.25 0.25 0.24 0.139 0.133 0.310.18 0.13 0.37 0.27 0.23

[0079] The weighted indices range from 0.3, which indicates noflattening or obstruction, to 0, which indicates gross obstruction. Theseparation point between these two classifications is 0.15, which may beused as a threshold value for comparison as described below.

[0080]FIG. 8 shows a normal breathing pattern. As can be seen from thetable, all three indices have approximately the same value, therebyindicating that no increase in CPAP is needed.

[0081]FIG. 9 is similar in form to FIG. 5 in that it shows a patternwith two lobes separated by a relatively flat region. As seen in thetable, if the equal weight index is used, no obstruction is found, whileboth improved indices are below the threshold and, therefore, bothindicate an obstructed breathing pattern.

[0082]FIG. 10 shows a pattern similar to the one in FIG. 6 that startsoff with a high initial lobe and then decays relatively slowly. For thispattern, the equal weight index and the value weighted index are bothabove the threshold. However, the time weighted index is below thethreshold indicating an obstructed breathing pattern.

[0083] Finally, FIG. 11 shows another normal breathing pattern which hasa shape somewhat different from the shape shown in FIG. 8. The threeindices in the Table are all above the threshold level therebyindicating a normal pattern as well.

[0084] Although the invention has been described with reference to aparticular embodiment, it is to be understood that this embodiment ismerely illustrative of the application the principles of the invention.Thus, it is to be understood that numerous modifications may be made inthe illustrative embodiment of the invention and other arrangements maybe devised without departing from the spirit and scope of the invention.For example, while the preferred embodiment of the invention appliesweighted samples to formulae which are used to identify a flattening ofairflow, a similar method might be used with other formulae that detectroundness of flow or its deviation there from using a sinusoidal orother similar function.

I claim:
 1. An apparatus for treating sleep apnea in a patientcomprising: a gas source adapted to selectively provide breathable gasto the patient under pressure; a flow sensor adapted to sense the flowof air breathed by the patient and to generate a flow signal indicativeof said gas flow; an obstruction detector coupled to said flow sensor,said obstruction detector including a weight assigning member arrangedto assign several weighting factors to portions of said flow signal andto generate an obstruction signal; and a controller arranged to controlthe operation of said gas source and coupled to said flow sensor, saidcontroller receiving said obstruction signal and altering the operationof said gas source in response to said obstruction signal.
 2. Theapparatus of claim 1 wherein said flow signal includes a sectioncorresponding to a single breathing cycle and wherein said portions areselected from said section.
 3. The apparatus of claim 1 wherein saidflow sensor includes a sampler that generates flow samples and whereinsaid weight assigning member is adapted to assign a weighting factor foreach sample.
 4. The apparatus of claim 3 wherein said samples haveamplitudes and said weight assigning member assigns said weightingfactors to said samples in accordance with said amplitudes.
 5. Theapparatus of claim 4 wherein said samples have time positions and saidweight assigning member assigns said weighting factors based on saidtime positions.
 6. An apparatus for monitoring or treating a patienthaving sleep disorder, said apparatus comprising: a flow sensor togenerate a flow signal indicative of the patient's respiration; and anobstruction detector coupled to said flow sensor and adapted todetermine a weighted average signal, said weighted average signal beingdependent on a weighted average of said flow signal in accordance withone of an amplitude and a time position of portions of said flow signal,said obstruction detector including a signal generator that generates asignal indicative of an airway obstruction based on said weightedaverage signal.
 7. An apparatus for treating a patient having sleepdisorder, said apparatus comprising: a mask; a gas source selectivelysupplying breathable air to said mask under pressure for the patient; aflow sensor to generate a flow signal indicative of the patient'srespiration; an obstruction detector coupled to said flow sensor andadapted to determine a weighted average signal, said weighted averagesignal being dependent on a weighted average of said flow signal inaccordance with one of an amplitude and a time position of portions ofsaid flow signal; and a controller receiving said obstruction signal andgenerating in response a command for activating said gas source.
 8. Theapparatus of claim 7 wherein said obstruction detector includes acomparator adapted to compare said weighted average signal to athreshold, said comparator generating said obstruction signal.
 9. Theapparatus of claim 7 wherein said flow sensor includes a sampler thatsenses samples of a single breathing cycle and wherein said obstructiondetector includes a weight assigning member that assigns a weightingfactor to each sample.
 10. The apparatus of claim 9 wherein each samplehas an amplitude and wherein said weight assigning member assigns saidweighting factor based on said amplitude.
 11. The apparatus of claim 10wherein said weight assigning member assigns said weighting factor basedon whether said amplitude is above or below a predetermined value. 12.The apparatus of claim 11 wherein said weight assigning member assigns afirst weighting factor to samples having amplitudes lower than saidpredetermined value and second weighting factors to samples havingamplitudes higher than said predetermined level.
 13. The apparatus ofclaim 12 wherein said first weighting factor is smaller than said secondweighting factor.
 14. The apparatus of claim 9 wherein each sample has atime position and wherein said weight assigning member assigns saidweighting factor based on said time position.
 15. The apparatus of claim14 wherein said weight assigning member assigns said weighting factorbased on whether said time position is before or after a predeterminedposition.
 16. The apparatus of claim 15 wherein said weight assigningmember assigns a first weight to samples having time positions beforesaid predetermined positions and second weighting factors to sampleshaving time positions after said predetermined position.
 17. Theapparatus of claim 16 wherein said first weighting factor is smallerthan said second weighting factor.
 18. The apparatus of claim 9 whereinsaid flow signal includes a section corresponding to a single breathingcycle and wherein said sampler samples a portion of said section. 19.The apparatus of claim 18 wherein said section corresponds to aninspiration period.
 20. The apparatus of claim 19 wherein said samplersamples a midportion of said inspiration period.
 21. A method ofdetecting an obstruction in the airway of a patient, said methodcomprising: measuring an air flow of the patient; detecting apredetermined section of said air flow; assigning weighting factors toportions of said predetermined section; determining an index value fromsaid predetermined section based on said weighting factors as a measureof the obstruction.
 22. The method of claim 21 wherein said portionsrepresent a midportion of inspiration.
 23. The method of claim 21further comprising assigning weighting factors to said portions based ontheir amplitudes.
 24. The method of claim 21 further comprisingassigning said weighting factors based on their time positions.
 25. Themethod of claim 21 further comprising assigning a first weighting factorto portions having amplitudes below a predetermined value and assigninga second weighting factor to portions having amplitudes above saidpredetermined value.
 26. The method of claim 25 further comprisingsetting said first weighting factor to be lower than said secondweighting factor.
 27. The method of claim 21 further comprisingassigning a first weighting factor to said portions having timepositions before a predetermined position and second weighting factorsother said portions having time positions after said predeterminedposition.
 28. The method of claim 27 wherein said first weighting factoris smaller than said second weighting factor.
 29. The method of claim 21further comprising generating said index value from a weighted mean ofsaid predetermined section.
 30. The method of claim 29 wherein saidweighted mean is the sum of the weighted absolute difference of the saidportions divided by the product of a mean of the predetermined sectionand the duration of said portions.
 31. A method of treating a personwith sleep apnea comprising the steps of: determining an air flow signalindicative of the air flow of the patient; sampling a section of saidair flow during successive breathing cycles to obtain a set of samplesfor a breathing cycle; assigning a weight to each sample; generating anobstruction signal based on said weights and said samples from said setof samples; and applying a CPAP therapy to the patient when anobstruction is indicated by said obstruction signal.
 32. The method ofclaim 31 wherein said set of samples comprises samples from a midportionof inspiration.
 33. The method of claim 32 further comprising the stepof generating an average of said midportion samples.
 34. The method ofclaim 33, wherein each sample has an amplitude, further comprising thestep of selecting a first weighting factor for samples having anamplitude below a predetermined threshold value and a second weightingfactor for samples having an amplitude above said predeterminedthreshold value.
 35. The method of claim 34 wherein said first weightingfactor is smaller than said second weighting factor.
 36. The method ofclaim 34 wherein said predetermined threshold value is a mean of saidflow signal.
 37. The method of claim 33, wherein each sample has a timeposition, further comprising the step of selecting a first weightingfactor for samples having time positions prior to a predetermined timeposition and selecting a second weighting factor for samples having timepositions after said predetermined time position.
 38. The method ofclaim 37 wherein said first weighting factor is smaller than said secondweighting factor.
 39. The method of claim 37 wherein said predeterminedtime position is a central point of said midportion.
 40. The method ofclaim 32 wherein said obstruction signal represents the sum of theweighted absolute difference of the said samples from a midportion ofinspiration divided by the product of a mean of the set of samples andthe duration of said midportion.